import Taro, { Component } from "@tarojs/taro";
import { View, Image } from "@tarojs/components";
import {getRuntime, servicePhoneNumber} from '../../utils/common'

import success_icon from '../../assets/img/icon_29.png'

// 表单提交成功
class SubmitSuccess extends Component{
  constructor(){
    super()
  }

  componentWillMount(): void {
    Taro.setNavigationBarTitle({ title:'预约成功' })
  }

  handelRouter(url: string = '/pages/index/index') {
    getRuntime().navigateTo(url)
  }

  makePhone(){
    getRuntime().makePhoneCall(servicePhoneNumber)
  }

  render() {
    return(
     <View className='apply-success'>
       <View className='content'>
         <Image className='success-icon' src={success_icon} />
         <View className='title'>申请预约办理成功</View>
         <View className='desc'>我们会尽快和您取得联系，请保持电话畅通~</View>
         <View className='tel'>咨询热线：{servicePhoneNumber}</View>
       </View>
       <View className='btn-group'>
         <View className='btn btn-active' onClick={this.handelRouter.bind(this, '/pages/index/index')}>返回首页</View>
         <View className='btn' onClick={this.makePhone.bind(this)}>电话咨询</View>
       </View>
     </View>
    )
  }
}

export default SubmitSuccess
